package cn.tedu.property_management_system.mapper;

import cn.tedu.property_management_system.entity.CarUser;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface CarMapper {
    @Insert("insert into car_charge values(#{id},#{chargeDate},#{arrivedDate},#{money},#{chargeState},#{chargePerson},#{remark},#{carId})")
    void insert(CarUser carUser);

    @Select("select * from car_charge")
    List<CarUser> select();

    @Select("select * from car_charge where car_id=#{carId}")
    List<CarUser> searchSelect(CarUser carUser);

    @Select("select * from car_charge where charge_state=#{chargeState}")
    List<CarUser> searchSelects(CarUser carUser);

    @Update("update car_charge set charge_state=#{chargeState},money=#{money},arrived_date=#{arrivedDate},charge_date=#{chargeDate} where car_id=#{carId}")
    void update(CarUser carUser);

    @Delete("delete from car_charge where id=#{id}")
    void delete(Integer id);
    @Select("select count(*) from car_charge")
    int countSelect();
}
